package pod

import (
	"gitee.com/xianglinzeng/gwayne/pkg/kubernetes/client"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/labels"
)

func ListKubePod(indexer *client.CacheFactory, namespace string, label map[string]string) ([]*corev1.Pod, error) {
	pods, err := indexer.PodLister().Pods(namespace).List(labels.SelectorFromSet(label))
	if err != nil {
		return nil, err
	}
	return pods, nil
}
